package com.wuchao.test;

import com.wuchao.mapper.Mapper;
import com.wuchao.pojo.Role;
import com.wuchao.pojo.User;
import com.wuchao.util.Util;
import org.apache.ibatis.session.SqlSession;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author 吴超66
 * @version 1.0
 * @date 2022/5/24 15:35
 */
public class T {
    public static void main(String[] args) {
        //这种最好 orm做完了
        SqlSession sqlSession = Util.getSqlSession();
     String [] ss=   new String[]{"小甜甜","超哥","sb","我就是这么牛"};
        Map<String,String []> map=new HashMap<>();
        map.put("key",ss);
        List<User> roleList = sqlSession.
                getMapper(Mapper.class).findUserByHashMap(map);
        for(User xjj : roleList) {
            System.out.print(xjj.getId() + "\t"+xjj.getName()+"\t"+xjj.getSex());
        }


       /* List<User> roleList = sqlSession.
                getMapper(Mapper.class).findUserByArray(new String[]{"小甜甜","超哥","sb"});
        for(User xjj : roleList) {
            System.out.print(xjj.getId() + "\t"+xjj.getName()+"\t"+xjj.getSex());
        }*/
      /*  Map<String,String> map=new HashMap<>();
        map.put("key","哥");
        List<User> roleList = sqlSession.getMapper(Mapper.class).findUserByMap(map);
        for(User xjj : roleList) {
            System.out.print(xjj.getId() + "\t"+xjj.getName()+"\t"+xjj.getSex());
        }*/
      /*  sqlSession.getMapper(Mapper.class).updateUserById1(1,"刷个晚",null);
        List<User> roleList =
                sqlSession.getMapper(Mapper.class).findUser(0,"超哥");
        for(User xjj : roleList) {
            System.out.print(xjj.getId() + "\t"+xjj.getName()+"\t"+xjj.getSex());
        }*/


       /* List<User> roleList = sqlSession.getMapper(Mapper.class).
                findUserAndRoleList2();*/
   /*     for(User xjj : roleList){
            System.out.print(xjj.getId()+"\t");
            for(Role role : xjj.getRoleList()){
                System.out.print(role.getName1()+"\t");
            }
            System.out.println(xjj.getSex());
        }*/
       /* List<User> roleList = sqlSession.getMapper(Mapper.class).
                findUserAndRoleList1("客");
        for(User xjj : roleList){
            System.out.println(xjj.getId()+"\t"+xjj.getRole().getName1()+"\t"+xjj.getSex());
        }*/
      /*  List<User> roleList = sqlSession.getMapper(Mapper.class).findUserAndRoleList();
        for(User xjj : roleList){
            System.out.println(xjj.getId()+"\t"+xjj.getName()+"\t"+xjj.getSex());
        }*/
       /* List<User> roleList = sqlSession.getMapper(Mapper.class).findRoleList();
        for(User xjj : roleList){
            System.out.println(xjj.getId()+"\t"+xjj.getName());
        }*/
     /*   sqlSession.getMapper(Mapper.class)
        sqlSession.getMapper(Mapper.class)
        sqlSession.getMapper(Mapper.class)
        sqlSession.getMapper(Mapper.class)*/



   /*     User user = new User();
        user.setId(4);
        user.setName("帅逼超");
        sqlSession.getMapper(Mapper.class).updateUserById(user);
        System.out.println("修改完毕");*/
        //sqlsesion 实现全局映射
      /*  sqlSession.getMapper(Mapper.class).delete(3);
        System.out.println("执行完毕");*/

       // user.setName("哥");
      /*  sqlSession.getMapper(Mapper.class).
                findUserByUserName(user).forEach(System.out::println);*/


    }
}
